package cn.tedu.egweibo1.result;

import lombok.*;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class JsonResult {

    private Integer statusCode;
    private String message;
    private Object data;
    public JsonResult(Status status) {
        this.statusCode = status.getStatusCode();
        this.message = status.getMessage();
    }
    public JsonResult(Status status, Object data){
        this(status);
        this.data = data;
    }
    public static JsonResult success(){
//        return new JsonResult(Status.OPERATION_SUCCESS);
//        return new JsonResult(Status.OPERATION_SUCCESS,null);
        return JsonResult.success(null);
    }
    public static JsonResult success(Object data){
        return new JsonResult(Status.OPERATION_SUCCESS,data);
    }
}
